<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <link href="../backPage/ui/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
    <script src="../backPage/ui/js/jquery-3.3.1.min.js"></script>
    <script src="../backPage/ui/js/Timetables.min.js"></script>
    <script src="../backPage/ui/js/bootstrap-treeview.js"></script>
    <script src="../backPage/ui/bootstrap-3.3.0/js/bootstrap.min.js"></script>
    <title>大学课表</title>
    <style>
        #coursesTable {
            padding: 15px 10px;
        }

        .Courses-head {
            background-color: #edffff;
        }

        .Courses-head > div {
            text-align: center;
            font-size: 14px;
            line-height: 28px;
        }

        .left-hand-TextDom, .Courses-head {
            background-color: #f2f6f7;
        }

        .Courses-leftHand {
            background-color: #f2f6f7;
            font-size: 12px;
        }

        .Courses-leftHand .left-hand-index {
            color: #9c9c9c;
            margin-bottom: 4px !important;
        }

        .Courses-leftHand .left-hand-name {
            color: #666;
        }

        .Courses-leftHand p {
            text-align: center;
            font-weight: 900;
        }

        .Courses-head > div {
            border-left: none !important;
        }

        .Courses-leftHand > div {
            padding-top: 5px;
            border-bottom: 1px dashed rgb(219, 219, 219);
        }

        .Courses-leftHand > div:last-child {
            border-bottom: none !important;
        }

        .left-hand-TextDom, .Courses-head {
            border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
        }

        .Courses-content > ul {
            border-bottom: 1px dashed rgb(219, 219, 219);
            box-sizing: border-box;
        }

        .Courses-content > ul:last-child {
            border-bottom: none !important;
        }

        .highlight-week {
            color: #02a9f5 !important;
        }

        .Courses-content li {
            text-align: center;
            color: #666666;
            font-size: 14px;
            line-height: 50px;
        }

        .Courses-content li span {
            padding: 6px 2px;
            box-sizing: border-box;
            line-height: 18px;
            border-radius: 4px;
            white-space: normal;
            word-break: break-all;
            cursor: pointer;
        }

        .grid-active {
            z-index: 9999;
        }

        .grid-active span {
            box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
        }
    </style>
</head>
<body>


<div class="container-fluid col-md-9 col-xs-12">
    <div id="coursesTable"></div>
</div>
<script>

    $(function(){
        $.ajax({
            url:"/studentManageSystem/getStudentCourseTable",
            type:"post",
            success:function(data){
                if(data == ""){
                    $("#coursesTable").empty();
                    alert("抱歉,该学生暂无未结课的选课信息");
                    return;
                }else{
                    $("#coursesTable").empty();
                    // 实例化(初始化课表)
                    var Timetable = new Timetables({
                        el: '#coursesTable',
                        timetables: eval(data),
                        week: week,
                        timetableType: courseType,
                        highlightWeek: day,
                        gridOnClick: function (e) {
                            // alert(e.name + '  ' + e.week + ', 第' + e.index + '节课, 课长' + e.length + '节');
                            // console.log(e);
                        },
                        styles: {
                            Gheight: 50
                        }
                    });
                }
            }
        })

    })

  var courseList = [
    ['大学英语(Ⅳ)@10203', '大学英语(Ⅳ)@10203', '', '', '', '', '毛概@14208', '毛概@14208', '', ''],
    ['', '', '信号与系统@11302', '信号与系统@11302', '模拟电子技术基础@16204', '模拟电子技术基础@16204', '', '', '', ''],
    ['大学体育(Ⅳ)', '大学体育(Ⅳ)', '形势与政策(Ⅳ)@15208', '形势与政策(Ⅳ)@15208', '', '', '电路、信号与系统实验', '电路、信号与系统实验', '', ''],
    ['', '', '', '', '电装实习@11301', '电装实习@11301', '', '',  '大学体育', '大学体育'],
    ['', '', '数据结构与算法分析', '数据结构与算法分析', '', '', '', '', '信号与系统', '信号与系统'],
  ];
  var week = ['星期一', '星期二', '星期三', '星期四', '星期五'];
  var day = new Date().getDay();
  var courseType = [
    [{index: '1', name: '第一大节 8:20-10:00'}, 2],
    [{index: '2', name: '第二大节 10:20-12:00'}, 2],
    [{index: '3', name: '第三大节 14:00-15:20'}, 2],
    [{index: '4', name: '第四大节 15:40-17:20'}, 2],
    [{index: '5', name: '第五大节 19:00-20:40'}, 2]
  ];
</script>
</body>
</html>
